package com.example.downloader.model;

import java.lang.ref.WeakReference;

/**
 * Created by Administrator on 2017/9/6 0006.
 */

public abstract class ProgressAware {


    private WeakReference<ProgressHolder> mProgressBarHolder;

    public int getId() {
        return id;
    }

    private int id;

    public ProgressAware(ProgressHolder progressHolder) {

        mProgressBarHolder = new WeakReference<ProgressHolder>(progressHolder);
        this.id = progressHolder.hashCode();
    }


    public ProgressHolder getProgressHolder() {
        return mProgressBarHolder.get();
    }


    protected abstract void setFreeState(boolean validated);

    protected abstract void setReadyState();

    protected abstract void setDownloadingState(int progress);

    protected abstract void setDownloadingFinishedState(DownloadInfo downloadInfo,String downloadPath);

    protected abstract void setErrorState();

    protected abstract  void setCancledState();

}
